let Mock = require('./mockSdk.js');
let dealList = require('./dealList.js');
// console.log(dealList);
let baseImgUrl = "https://lg-igjc8p1o-1256763078.cos.ap-shanghai.myqcloud.com/meituan_N12/upload/"
// 首页轮播图API
Mock.mock('http://api.meituan.com/index/swiper', {
  "data": [
    {
      id: 1,
      img_src: baseImgUrl + "banner1.png",
      link: ""
    }, {
      id: 2,
      img_src: baseImgUrl + "banner2.png",
      link: ""
    }, {
      id: 3,
      img_src: baseImgUrl + "banner3.png",
      link: ""
    }
  ],
  errMsg: "request: ok",
  statusCode: 200,
});

// 首页入口列表API
Mock.mock('http://api.meituan.com/index/entry', {
  "data": [
    {
      id: 1,
      icon: "meishi",
      text: "美食",
      link: "",
      open_type: "navigate"
    },
    {
      id: 2,
      icon: "dianying",
      text: "猫眼电影",
      link: "",
      open_type: "navigate"
    },
    {
      id: 3,
      icon: "jiudian",
      text: "酒店住宿",
      link: "",
      open_type: "navigate"
    },
    {
      id: 4,
      icon: "xiuxianyule",
      text: "休闲娱乐",
      link: "",
      open_type: "navigate"
    },
    {
      id: 5,
      icon: "waimai",
      text: "外卖",
      link: "",
      open_type: "navigate"
    },
    {
      id: 6,
      icon: "ktv",
      text: "KTV",
      link: "",
      open_type: "navigate"
    },
    {
      id: 7,
      icon: "liren",
      text: "丽人/美发",
      link: "",
      open_type: "navigate"
    },
    {
      id: 8,
      icon: "zhoubianyou",
      text: "景点门票",
      link: "",
      open_type: "navigate"
    },
    {
      id: 9,
      icon: "xiaochikuaican",
      text: "小吃快餐",
      link: "",
      open_type: "navigate"
    },
    {
      id: 10,
      icon: "quanbu",
      text: "全部分类",
      link: "",
      open_type: "navigate"
    }
  ],
  errMsg: "request: ok",
  statusCode: 200,
});

// 首页拼团API
Mock.mock('http://api.meituan.com/index/pingtuan', {
  "data|5-10": [
    {
      id: 1,
      img_src: baseImgUrl + "pingtuan01.png",
      brand_name: "【两个装】随手贴随手贴随手贴",
      price: "26.00",
      old_price: "26.00",
      link: ""
    },
    {
      id: 2,
      img_src: baseImgUrl + "pingtuan02.png",
      brand_name: "【两个装】随手贴随手贴随手贴",
      price: "26.00",
      old_price: "26.00",
      link: ""
    }
  ],
  errMsg: "request: ok",
  statusCode: 200,
});

// 首页广告API
Mock.mock('http://api.meituan.com/index/ad', {
  "data": [
    {
      id: 1,
      img: baseImgUrl + "index_ad01.png",
      name: "华莱士",
      link: ""
    },
    {
      id: 2,
      img: baseImgUrl + "index_ad02.png",
      name: "串串香",
      link: ""
    },
    {
      id: 3,
      img: baseImgUrl + "index_ad03.png",
      name: "千层果道",
      link: ""
    },
    {
      id: 4,
      img: baseImgUrl + "index_ad04.png",
      name: "轰趴馆",
      link: ""
    }
  ],
  errMsg: "request: ok",
  statusCode: 200,
});


// let location = wx.getStorageSync('location') || { "lat": 23.12463, "lng": 113.36199 };
// 首页猜你喜欢
Mock.mock('http://api.meituan.com/index/like', {
  "data": 
    [
      {
        "id": 1,
        "distance": { "lat": 23.12495, "lng": 113.36216 },
        "img_src": "http://p0.meituan.net/200.0/deal/40f9cfbd8c8a17f45850b1cfa63a520075722.jpg",
        "brand_name": "巴喜阳光BBQ自助餐厅",
        "desc": "[体育中心]单人自助午餐",
        "price": 58,
        "old_price": 80,
        "discount": "7.25折",
        "count": 32882
      },
      {
        "id": 2,
        "distance": { "lat": 23.12508, "lng": 113.36264 },
        "img_src": "http://p1.meituan.net/200.0/dpdeal/2240fd9ee6bd64f18cc1aa3e97a17308170818.jpg",
        "brand_name": "长藤鬼校(广州旗舰店)",
        "desc": "[北京路商业区]单人恐怖体验票1张",
        "price": 77,
        "old_price": 150,
        "discount": "5.14折",
        "count": 27238
      },
      {
        "id": 3,
        "distance": { "lat": 23.12484, "lng": 113.36297 },
        "img_src": "http://p0.meituan.net/200.0/deal/af4593992d6014d69f253c5ce16e4d6043033.jpg",
        "brand_name": "点都德",
        "desc": "[28店通用]100元代金券1张",
        "price": 90,
        "old_price": 100,
        "discount": "9折",
        "count": 438667
      },
      {
        "id": 4,
        "distance": { "lat": 23.1252, "lng": 113.36226 },
        "img_src": "http://p1.meituan.net/200.0/deal/8cea8c2222168755a35bddcac5e459ac144498.jpg",
        "brand_name": "四海一家",
        "desc": "[番禺区]周一至周四单人自助晚餐",
        "price": 158,
        "old_price": 168,
        "discount": "9.41折",
        "count": 116194
      },
      {
        "id": 5,
        "distance": { "lat": 23.12467, "lng": 113.36283 },
        "img_src": "http://p0.meituan.net/200.0/deal/981b496f0049c79fa011175b68cbbc75431769.jpg",
        "brand_name": "至尊比萨-手工披萨",
        "desc": "[36店通用]超值比萨双人餐，提供免费WiFi",
        "price": 38,
        "old_price": 75,
        "discount": "5.07折",
        "count": 16656
      },
      {
        "id": 6,
        "distance": { "lat": 23.12502, "lng": 113.36265 },
        "img_src": "http://p1.meituan.net/200.0/deal/e5637191d9dba2b40c6eac4ef8c2604c81238.jpg",
        "brand_name": "真功夫",
        "desc": "[广州等]功夫黄焖鸡饭+生菜王1份",
        "price": 19,
        "old_price": 24,
        "discount": "7.92折",
        "count": 8525
      },
      {
        "id": 7,
        "distance": { "lat": 23.1253, "lng": 113.36246 },
        "img_src": "http://p0.meituan.net/200.0/deal/442c6ae9638a1cc910e97fe7ac7f661727261.jpg",
        "brand_name": "傣妹火锅",
        "desc": "[越秀区]50元代金券1张，可叠加",
        "price": 47,
        "old_price": 50,
        "discount": "9.4折",
        "count": 16616
      },
      {
        "id": 8,
        "distance": { "lat": 23.1255, "lng": 113.3628 },
        "img_src": "http://p0.meituan.net/200.0/deal/3fd5e30a3496ac7cee7503592c42242d43773.jpg",
        "brand_name": "遇见小面",
        "desc": "[15店通用]小小酸辣粉1份，提供免费WiFi",
        "price": 9.99,
        "old_price": 14,
        "discount": "7.14折",
        "count": 2751
      },
      {
        "id": 9,
        "distance": { "lat": 23.1254, "lng": 113.36217 },
        "img_src": "http://p0.meituan.net/200.0/deal/__49188868__3873536.jpg",
        "brand_name": "南北和自助火锅",
        "desc": "[大石]限时90分钟自助",
        "price": 34.9,
        "old_price": 49,
        "discount": "7.13折",
        "count": 23206
      },
      {
        "id": 10,
        "distance": { "lat": 23.12505, "lng": 113.36285 },
        "img_src": "http://p0.meituan.net/200.0/deal/82aa430ecf66cdffc775fdc851b2704b43921.jpg",
        "brand_name": "华莱士",
        "desc": "[广州等]豪华手扒鸡双人餐",
        "price": 31.5,
        "old_price": 47,
        "discount": "6.71折",
        "count": 16494
      },
      {
        "id": 11,
        "distance": { "lat": 23.12516, "lng": 113.36268 },
        "img_src": "http://p0.meituan.net/200.0/deal/c228b76a9bd5f9e4da4985b0d42584d566832.jpg",
        "brand_name": "银记肠粉店",
        "desc": "[11店通用]劲爆双人餐，提供免费WiFi",
        "price": 33.8,
        "old_price": 54,
        "discount": "6.26折",
        "count": 25145
      },
      {
        "id": 12,
        "distance": { "lat": 23.12526, "lng": 113.36255 },
        "img_src": "http://p0.meituan.net/200.0/deal/0eada2bfae9e54b493f59d4a48ef067360810.jpg",
        "brand_name": "食上签串串香",
        "desc": "[3店通用]100元代金券1张",
        "price": 68,
        "old_price": 100,
        "discount": "6.8折",
        "count": 12024
      },
      {
        "id": 13,
        "distance": { "lat": 23.12514, "lng": 113.36207 },
        "img_src": "http://p1.meituan.net/200.0/deal/709a0c5eb291d3feb463114527b4c3571071769.jpg",
        "brand_name": "大师兄·肉夹馍·陕西面馆",
        "desc": "[7店通用]老潼关肉夹馍1份",
        "price": 9.9,
        "old_price": 12,
        "discount": "8.26折",
        "count": 9596
      },
      {
        "id": 14,
        "distance": { "lat": 23.12518, "lng": 113.36276 },
        "img_src": "http://p0.meituan.net/200.0/deal/ebe525161e393660693fee577d544aa974119.jpg",
        "brand_name": "黄记煌三汁焖锅",
        "desc": "[越秀区]超值焖锅套餐，建议2-3人使用",
        "price": 138,
        "old_price": 238,
        "discount": "5.8折",
        "count": 5970
      },
      {
        "id": 15,
        "distance": { "lat": 23.12491, "lng": 113.36273 },
        "img_src": "http://p0.meituan.net/200.0/dpdeal/5d18171d0947e2889442a8414713360a134344.jpg",
        "brand_name": "西郊游泳场",
        "desc": "[荔湾区]清凉双人单次票",
        "price": 62.8,
        "old_price": 100,
        "discount": "6.28折",
        "count": 39786
      },
      {
        "id": 16,
        "distance": { "lat": 23.12528, "lng": 113.36248 },
        "img_src": "http://p0.meituan.net/200.0/deal/62fe9e1279f84fc79aaf775755b44016107098.jpg",
        "brand_name": "阿强酸菜鱼",
        "desc": "[5店通用]100元代金券1张，可叠加3张",
        "price": 88,
        "old_price": 100,
        "discount": "8.8折",
        "count": 29333
      },
      {
        "id": 17,
        "distance": { "lat": 23.12544, "lng": 113.36273 },
        "img_src": "http://p1.meituan.net/200.0/deal/5c7e67cfc93328ddc3a4c32ae19b666143728.jpg",
        "brand_name": "又一间茶点轩",
        "desc": "[5店通用]4人点心套餐，提供免费WiFi",
        "price": 138,
        "old_price": 186,
        "discount": "7.42折",
        "count": 30773
      },
      {
        "id": 18,
        "distance": { "lat": 23.12496, "lng": 113.36276 },
        "img_src": "http://p1.meituan.net/200.0/deal/939f368b97fb17526447805441995df848449.jpg",
        "brand_name": "东川饭局",
        "desc": "[10店通用]特色招牌2选1，提供免费WiFi",
        "price": 9.5,
        "old_price": 15,
        "discount": "6.34折",
        "count": 4071
      },
      {
        "id": 19,
        "distance": { "lat": 23.12475, "lng": 113.36206 },
        "img_src": "http://p1.meituan.net/200.0/deal/12765d49c31c635eb9fa2374e668d0c5178879.jpg",
        "brand_name": "大龙燚火锅",
        "desc": "[3店通用]100元大龙燚可叠加代金券1张",
        "price": 88,
        "old_price": 100,
        "discount": "8.8折",
        "count": 13676
      },
      {
        "id": 20,
        "distance": { "lat": 23.12526, "lng": 113.36284 },
        "img_src": "http://p0.meituan.net/200.0/deal/3491f4c0bbbc68090b364c68a409f7e2488247.jpg",
        "brand_name": "探蟹肉蟹煲",
        "desc": "[广州等]豪华两人套餐，提供免费WiFi",
        "price": 138,
        "old_price": 178,
        "discount": "7.76折",
        "count": 176817
      },
      {
        "id": 21,
        "distance": { "lat": 23.12528, "lng": 113.36261 },
        "img_src": "http://p0.meituan.net/200.0/deal/__45552670__1292243.jpg",
        "brand_name": "十分牛焰火牛排",
        "desc": "[2店通用]牛排2人餐，免费WiFi",
        "price": 92,
        "old_price": 217,
        "discount": "4.24折",
        "count": 190596
      },
      {
        "id": 22,
        "distance": { "lat": 23.12476, "lng": 113.36298 },
        "img_src": "http://p0.meituan.net/200.0/deal/1c04aae0cc59af9869e53fd1d7060f0a36055.jpg",
        "brand_name": "Taning挞柠·匠心柠檬茶",
        "desc": "[27店通用]特价饮品3选1，提供免费WiFi",
        "price": 9.9,
        "old_price": 13,
        "discount": "7.62折",
        "count": 57103
      },
      {
        "id": 23,
        "distance": { "lat": 23.1249, "lng": 113.36203 },
        "img_src": "http://p0.meituan.net/200.0/deal/1fd90dceacde184b378daa7283970904150612.jpg",
        "brand_name": "辛明堂洞韩式芝士年糕火锅",
        "desc": "[万达广场]年糕火锅2人套餐",
        "price": 68,
        "old_price": 152,
        "discount": "4.48折",
        "count": 60633
      },
      {
        "id": 24,
        "distance": { "lat": 23.12485, "lng": 113.36224 },
        "img_src": "http://p0.meituan.net/200.0/deal/86e3f05249fca23597952ed2d50e6411134265.jpg",
        "brand_name": "阪尚皇",
        "desc": "[越秀区]阪尚皇烤肉火锅寿司单人自助晚餐",
        "price": 59.8,
        "old_price": 71,
        "discount": "8.43折",
        "count": 242571
      },
      {
        "id": 25,
        "distance": { "lat": 23.12505, "lng": 113.36241 },
        "img_src": "http://p1.meituan.net/200.0/deal/c5e5f767d1f9324fccee69868d11213d60510.jpg",
        "brand_name": "陈记顺和",
        "desc": "[20店通用]精选牛肉火锅4人餐",
        "price": 278,
        "old_price": 348,
        "discount": "7.99折",
        "count": 2738
      },
      {
        "id": 26,
        "distance": { "lat": 23.12481, "lng": 113.36246 },
        "img_src": "http://p0.meituan.net/200.0/deal/83fda57bab160680458d0c889d0886f5670781.jpg",
        "brand_name": "尊宝比萨",
        "desc": "[广州等]二人套餐",
        "price": 72,
        "old_price": 112,
        "discount": "6.43折",
        "count": 31713
      },
      {
        "id": 27,
        "distance": { "lat": 23.12546, "lng": 113.36294 },
        "img_src": "http://p1.meituan.net/200.0/dpdeal/a08ce25fde3e270c3118245294bbd23d434851.png",
        "brand_name": "大世界保龄球馆",
        "desc": "[体育中心]双人保龄球套餐",
        "price": 52.5,
        "old_price": 118,
        "discount": "4.45折",
        "count": 7022
      },
      {
        "id": 28,
        "distance": { "lat": 23.12555, "lng": 113.36218 },
        "img_src": "http://p1.meituan.net/200.0/deal/7b42f41f65e59d4ceb99e68b0a50a2c287857.jpg",
        "brand_name": "汕头八合里海记牛肉店",
        "desc": "[广州等]双人套餐，提供免费WiFi",
        "price": 162,
        "old_price": 203,
        "discount": "7.99折",
        "count": 95352
      },
      {
        "id": 29,
        "distance": { "lat": 23.12557, "lng": 113.36267 },
        "img_src": "http://p1.meituan.net/200.0/deal/81e0fe3b5de905caaa5840d6e71e40e987659.jpg",
        "brand_name": "摩能肉蟹煲",
        "desc": "[10店通用]✨电子代金券✨【限量抢购新客减10元】1张",
        "price": 95,
        "old_price": 100,
        "discount": "9.5折",
        "count": 12019
      },
      {
        "id": 30,
        "distance": { "lat": 23.12534, "lng": 113.36277 },
        "img_src": "http://p1.meituan.net/200.0/deal/96e016626996de0e32902cc19773798c61730.jpg",
        "brand_name": "淼福猪肚鸡",
        "desc": "[5店通用]温馨二人餐，提供免费WiFi",
        "price": 98,
        "old_price": 132,
        "discount": "7.43折",
        "count": 15399
      }
    ]
,
  // [
  //   {
  //     "id|+1": 1,
  //     img: "@image(160x160)",
  //     name: "@ctitle(3,10)",
  //     desc: "[@county()]@cparagraph(1)",
  //     price: '@natural(10, 200)',
  //     count: '@natural(60, 10000)',
  //     discount: "@float(4, 9, 1 ,2)折",
  //     link: "", 
  //     distance: function () {
  //       return {
  //         "lat": location.lat + (Mock.Random.natural(1, 100) * 0.00001),
  //         "lng": location.lng + (Mock.Random.natural(1, 100) * 0.00001)
  //       }
  //     }
  //   }
  // ],
  errMsg: "request: ok",
  statusCode: 200,
});

